package com.zoe.onelink.logging.biz.persistent;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2021</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2021-11-26
 */
public class BizLogPersistentFactory {

    private final Map<String, IBizLogPersistent> persistentMap = new HashMap<>();

    public BizLogPersistentFactory(List<IBizLogPersistent> persistents) {
        if (persistents == null) {
            return;
        }
        for (IBizLogPersistent persistent : persistents) {
            persistentMap.put(persistent.getClass().getSimpleName(), persistent);
        }
    }

    public IBizLogPersistent getInstance(String classSimpleName) {
        return this.persistentMap.get(classSimpleName);
    }

}
